<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
</head>

<body>
    <!-- v-model双向绑定 -->
    <!-- v-model**
            实现从DOM将数据绑定到vue
            当我们在输入框输入值的时候，
            v-model会实时将最新值(value)赋值给vue实例的message变量，
            而message变量又将实时展现在标签中 -->
    <div id="app" v-bind:class="clazz">
        <p>{{ message }}</p>
        <br>
        <input type="text" v-model="message" />
        <br>
        <!-- 模拟登录测试 -->
        <input type="text" v-model="account"><br>
        <input type="password" v-model="pwd"><br>
        <button v-on:click="login()">登录Click Me</button><br>

        <h1>测试多选框 赋值传递</h1>

        <!-- 测试多选框 -->
        <input type="checkbox" v-model="checkbox" value="黑格尔">黑格尔<br>
        <input type="checkbox" v-model="checkbox" value="康德">康德<br>
        <input type="checkbox" v-model="checkbox" value="笛卡尔">笛卡尔<br> {{checkbox}}
    </div>

    <script>
        //创建Vue对象
        let vue = new Vue({
            el: "#app",
            data: {
                message: "hello",
                account: "",
                pwd: "",
                checkbox: []
            },
            methods: {
                login: function() {
                    console.log(this.account, this.pwd);
                }
            },
        });
    </script>
</body>

</html>